#define _CRT_SECURE_NO_WARNINGS 1
int comp(void* p1, void* p2) { return *(int*)p1 - *(int*)p2; }
double findMedianSortedArrays(int* nums1, int nums1Size, int* nums2,
    int nums2Size) {
    int t = nums1Size + nums2Size;
    int* n = calloc((t + 1), sizeof(int));
    int i;
    for (i = 1; i <= nums1Size; i++) {
        n[i] = nums1[i - 1];
    }
    int k = 0;
    for (i = nums1Size + 1; i <= t; i++) {
        n[i] = nums2[k++];
    }
    qsort(n + 1, t, sizeof(int), comp);
    if (t % 2)
    {
        return (double)n[(t + 1) / 2];

    }
    else
    {
        return (double)(n[t / 2] + n[t / 2 + 1]) / 2;
    }
    return 0.0;
}